package edu.berkeley.cs160.innovationers.shoppersidekick;

import java.io.IOException;
import java.io.Serializable;
import java.util.ArrayList;

public class ShoppingList implements Serializable{
	//Note: MemberList here is the checked member for this shopping list
	private ArrayList<Member> MembersList;
	private ArrayList<Item> ItemList;
	private String Name;
	private boolean onShopping = false;
	private String Owner;
	
	public ShoppingList(String N){
		Name = new String(N);
		MembersList = new ArrayList<Member>();
		ItemList = new ArrayList<Item>();
	}
	
	public ShoppingList(String N, int memberCount){
		MembersList = new ArrayList<Member>();
		ItemList = new ArrayList<Item>();
	}
	public ShoppingList(String N, ArrayList<Member> memList, ArrayList<Item> itemList){
		Name = new String(N);
		MembersList = memList;
		ItemList = itemList;
	}

	
	public String getName(){
		return Name;
	}
	public void setName(String N){
		Name = N;
	}
	
	public ArrayList<Member> getMemberList(){
		return MembersList;
	}
	public void setMemberList(ArrayList<Member> mList) {
		MembersList = mList;
	}
	public ArrayList<Item> getItemList(){
		return ItemList;
	}
	
	public void setShopping(){
		onShopping = !onShopping;
	}
	public void setShopping(boolean set){
		onShopping = set;
	}
	 
	public boolean isShopping(){
		return onShopping;
	}
	public void addItem(String title, String content){
		ItemList.add(new Item(new String(title) , Integer.parseInt(content)));
	}
	public void addMember(Member newMem){
		
		MembersList.add(newMem);
	}

	public void setOwner(String n){
		Owner = n;
	}
	
	public String getOwner(){
		return Owner;
	}
	
	public void renewShoppingList(ArrayList<Item> newList){
		ItemList = newList;
	}
}
